﻿using ProjectCore.Common;
using ProjectCore.Domain.DomainService;
using ProjectCore.Domain.Model.Entity;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace ProjectCore.Application
{
    public class AppRoles : IAppRoles
    {
        private readonly IRolesDomainService rolesDomainService;
        public AppRoles(IRolesDomainService _rolesDomainService)
        {
            rolesDomainService = _rolesDomainService;
        }

        /// <summary>
        /// 角色添加
        /// </summary>
        /// <param name="roles"></param>
        /// <returns></returns>
        public async Task<int> AddRoles(Roles roles)
        {
            return await rolesDomainService.AddRoles(roles);
        }

        /// <summary>
        /// 获取角色集合
        /// </summary>
        /// <returns></returns>
        public async Task<HeaderResult<List<Roles>>> GetRoles(int pageIndex, int pageSize)
        {
            return await rolesDomainService.GetRoles(pageIndex,pageSize);
        }

        /// <summary>
        /// 逻辑删除
        /// </summary>
        /// <returns></returns>

        public async Task<int> IsDel(int Id)
        {
            return await rolesDomainService.IsDel(Id);
        }

        /// <summary>
        /// 修改角色
        /// </summary>
        /// <returns></returns>
        public async Task<int> UptRoles(Roles roles)
        {
            return await rolesDomainService.UptRoles(roles);
        }

        /// <summary>
        /// 获取角色
        /// </summary>
        /// <returns></returns>
        public async Task<Roles> GetRole(int Id)
        {
            return await rolesDomainService.GetRole(Id);
        }



        /// <summary>
        /// 获取角色权限
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        
        public async Task<List<RoleMenus>> GetRoleMenus(int Id)
        {
            return await rolesDomainService.GetRoleMenus(Id);
            
        }


        //修改角色权限
        public async Task<int> UptRoleMenu(List<int> li, int Id)
        {
            return await rolesDomainService.UptRoleMenu(li, Id);
        }
    }
}
